home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 015a / vaxutils.zip / CD.COM next >
Text File  |  1987-07-24  |  2KB  |  76 lines

  1. $!   CD.COM changes the VMS prompt to show node and directory
  2. $!
  3. $!   This procedure was transcribed from the Languages & Tools section of the
  4. $! July, 1987, DECUS SIGs Newsletter.  It was modified slightly by Frank
  5. $! Mallory; the node and device display were commented out, so that it gives
  6. $! a prompt consisting only of the directory.
  7. $!
  8. $!   To invoke CD, put the following commands or equivalent in your LOGIN.COM:
  9. $! CD==        "@RSC_USERS:[MALLORY]CD.COM"
  10. $! COMM==    "@RSC_USERS:[MALLORY]CD RSC_USERS:[MALLORY.COMM]" ! For each
  11. $! logical that is used to set a new default directory (replaces SET DEF)
  12. $! CD [MALLORY]
  13. $!
  14. $
  15. $    V = F$verify(0)
  16. $    If P1 .nes. "" then SET DEFAULT 'P1'
  17. $
  18. $    ESC[0,8]    = 27
  19. $    Bold_on        = ESC + "[1m"
  20. $    Bold_off    = ESC + "[0m"
  21. $    First_part    = ""
  22. $    Max_length    = 23
  23. $!    Node        = F$Getsyi("NODENAME")
  24. $!    Device        = F$Trnlmn("SYS$DISK")
  25. $!
  26. $!CHECK:
  27. $!    If F$length("''device'") .LT. 6 then GOTO CONCAT
  28. $!
  29. $!    Place        = F$locate("$", device)
  30. $!    If Place .EQ. F$length(Device) then GOTO NEXT
  31. $!    Temp        = F$extract(Place + 1, F$length(device),device);
  32. $!
  33. $!UP_THERE:
  34. $!    If F$length("''temp'") .GT. 6 then GOTO THERE
  35. $!
  36. $!    Device        = Temp
  37. $!    GOTO CONCAT
  38. $!
  39. $!THERE:
  40. $!    Place        = F$locate("$", temp)
  41. $!    If Place .EQ. F$length(temp) then GOTO NEXT
  42. $!
  43. $!    Temp        = F$extract(Place + 1, F$length(temp),temp)
  44. $!    GOTO UP_THERE
  45. $!
  46. $!NEXT:
  47. $!    Device        = F$extract(0, f$locate(":", device),device)
  48. $!    Device        = F$trnlmn("''device'")
  49. $!    GOTO CHECK
  50. $!
  51. $!CONCAT:
  52. $!    First_part    = Node + "::"''device'"
  53. $    Cur_dir        = First_part + F$directory()
  54. $    If F$length(Cur_dir) .LE. Max_length then GOTO CHANGE_PROMPT
  55. $
  56. $    Abbrev_dir    = Cur_dir
  57. $    Abv_Length    = 'Max_length' - 'F$length(First_part)' - 4
  58. $    
  59. $ FIND_PERIOD:
  60. $    Period        = F$locate(".", Abbrev_dir)
  61. $    If Period .EQ. F$length(Abbrev_dir) then GOTO ABBREV_PROMPT
  62. $
  63. $    Abbrev_dir    = F$extract(Period + 1, -
  64.                         F$length(Abbrev_dir) - 1, -
  65.                                     Apprev_dir)
  66. $    If F$length(Abbrev_dir) .GT. 'Abv_length' then GOTO FIND_PERIOD
  67. $
  68. $ ABBREV_PROMPT:
  69. $    If 'F$length(Abbrev_dir)' .GT. 'Abv_length' then -
  70.        Abbrev_dir    = F$extract(0, Abbrev_length - 1, Abbrev_dir) + "]"
  71. $    Cur_dir        = First_part + "[..." + "'Abbrev_dir'"
  72. $
  73. $ CHANGE_PROMPT:
  74. $    Set Prompt     = "''Bold_on'''Cur_dir'$''Bold_off'"
  75. $    V        = F$verify(V)
  76.